home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / DllStructGetData.au3 < prev    next >
Text File  |  2007-09-08  |  960b  |  30 lines

  1. $p    = DllStructCreate("dword dwOSVersionInfoSize;dword dwMajorVersion;dword dwMinorVersion;dword dwBuildNumber;dword dwPlatformId;char szCSDVersion[128]")
  2.  
  3. ;think of this as p->dwOSVersionInfoSize = sizeof(OSVERSIONINFO)
  4. DllStructSetData($p, "dwOSVersionInfoSize", DllStructGetSize($p))
  5.  
  6. ;make the DllCall
  7. $ret = DllCall("kernel32.dll","int","GetVersionEx","ptr",DllStructGetPtr($p))
  8.  
  9. if Not $ret[0] Then
  10.     MsgBox(0,"DllCall Error","DllCall Failed")
  11.     exit
  12. EndIf
  13.  
  14. ;get the returned values
  15. $major        = DllStructGetData($p,"dwMajorVersion")
  16. $minor        = DllStructGetData($p,"dwMinorVersion")
  17. $build        = DllStructGetData($p,"dwBuildNumber")
  18. $platform    = DllStructGetData($p,"dwPlatformId")
  19. $version    = DllStructGetData($p,"szCSDVersion")
  20.  
  21. ;free the struct
  22. $p =0
  23.  
  24. msgbox(0,"","Major: " & $major & @CRLF & _
  25.             "Minor: " & $minor & @CRLF & _
  26.             "Build: " & $build & @CRLF & _
  27.             "Platform ID: " & $platform & @CRLF & _
  28.             "Version: " & $version)
  29.  
  30.